//
//  CustomLog.swift
//  vr_web
//
//  Created by 李旭峰 on 2020/7/13.
//

import Foundation
import UIKit

enum AsmanServerLogType {
    case send
}

enum AsmanLogType {
    case Error
}

func dPrintLog(_ tag:String,_ message: @autoclosure () -> Any){
//    DebugUIManager.ShareInstance().addDebug("\(tag) log : ")
//    DebugUIManager.ShareInstance().addDebug("\(message())")
    #if DEBUG
    print("****************************************************************");
    print("\(tag) log : ");
    print(message())
    print("end")
    print("****************************************************************");
    #endif
}

func dPrintLog(_ type:AsmanLogType,_ message: @autoclosure () -> Any){
    
}

func dPrintServerSend(_ message: @autoclosure () -> Any) {
//    DebugUIManager.ShareInstance().addDebug("server send: - \(message())")
    #if DEBUG
    print("server send: - ",message())
    #endif
}
func dPrintLog(_ message: @autoclosure () -> Any) {
//    DebugUIManager.ShareInstance().addDebug("normal log: - \(message())")
    #if DEBUG
    print("normal log: - ",message())
    #endif
}
func dPrintServerError(_ message: @autoclosure () -> Any) {
//    DebugUIManager.ShareInstance().addDebug("server error: - \(message())")
    #if DEBUG
    print("server error: - ",message())
    #endif
}
func dPrintServerResponse(_ message: @autoclosure () -> Any) {
//    DebugUIManager.ShareInstance().addDebug("server response: - \(message())")
    #if DEBUG
    print("server response: - ",message())
    #endif
}

private let screen_max_length = max(kScreenWidth, kScreenHeight)
private let screen_min_length = min(kScreenWidth, kScreenHeight)

public func isIphone() -> Bool {
    return UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.phone
}
public func isIphone4() -> Bool{
    return isIphone() && screen_max_length < 568.0
}
public func isIphone5() -> Bool{
    return isIphone() && screen_max_length == 568.0
}
public func isIphone6() ->Bool{
    return isIphone() && screen_max_length == 667.0
}
public func isIphone6P() ->Bool {
    return isIphone() && screen_max_length == 736.0
}
public func isIphoneXSMax() -> Bool {
    return isIphone() && screen_max_length >= 896.0
}
public func isIphoneX() -> Bool {
    return isIphone() && screen_max_length >= 812.0
}
public func statusBarHeight() -> CGFloat {
    if isIphoneX() { return 44 }
    else { return 20 }
}

public let kNavi_HEIGHT = isIphoneX() ? CGFloat(88) : CGFloat(64)
public let kTabbar_HEIGHT = isIphoneX() ? CGFloat(83) : CGFloat(49)
public let kState_HEIGHT = UIApplication.shared.statusBarFrame.height

public let bIsIphoneX = isIphoneX()
public let vSafeTop:CGFloat = !bIsIphoneX ? 20.0 : 44.0
public let vSafeBottom:CGFloat = !bIsIphoneX ? 0.0 : 43.0
public let vSafeBeautyBottom:CGFloat = !bIsIphoneX ? 0.0 : 12.0
public let vStatusBarHeight:CGFloat = !bIsIphoneX ? 20.0 : 44.0
public let vNoStatusBarSageTop:CGFloat = !bIsIphoneX ? 0.0 : 44.0

func CallUpDialing(_ num:String,didCompleted:@escaping ()->()){
    guard let url = URL(string: "tel:" + num) else { return }
    UIApplication.shared.open(url, options: [:]) { (success) in
        didCompleted()
    }
}
func t(){
    CallUpDialing("") {
        
    }
}
/// 测试环境
let testBundleId:String = "com.asman.xiaoniuge.dev"
/// 发布环境
let releaseBundleId:String = "com.asman.xiaoniuge"
extension String {
    func isTest() -> Bool {
        return self == testBundleId
    }
    func isRelease() -> Bool {
        return self == releaseBundleId
    }
}
/// 客服组ID
struct CustomerGroupId {
    /// 设计师组
    static let designerGroup = "264344447"
    /// 售前组
    static let preGroup = "264345444"
    /// 售后组
    static let afterGroup = "264345445"
}

